﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Web.Mvc;

namespace SpyApp.Models.BaseCommon
{
    public class SelectListUtils
    {
        public static void SelectListItem_SetSelected(List<string> _listValue, List<SelectListItem> _selectList)
        {
            for (int listIndex = 0; listIndex < _selectList.Count(); listIndex++)
            {
                SelectListItem item = _selectList.ElementAt(listIndex);
                for (int valueIndex = 0; valueIndex < _listValue.Count(); valueIndex++)
                {
                    string value = _listValue.ElementAt(valueIndex);
                    if (item.Value == value)
                    {
                        item.Selected = true;
                        break; // đã chọn => đi nha em
                    }
                }
            }
        }
    }
}